home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-05-17 | 892 b | 53 lines | [TEXT/MSET] |
- \ StringArray - MRH May 86.
-
- \ This class adds suitable indexed methods to the class Bytestring.
-
- need bytestring
-
- :class STRINGARRAY super{ bytestring array }
-
- int CURRENT
-
- :m CURRENT:
- get: current ;m
-
- :m (SEL): { idx -- }
- idx put: current
- idx ^elem4 @ ^base !
- nil?: self ?EXIT
- ^base size: handle put: size ;m
-
- :m SELECT: { idx -- }
- idx (sel): self
- nil?: self
- IF \ new: not done - do it now
- new: super
- handle: self idx ^elem4 !
- ELSE
- reset: self
- THEN ;m
-
- :m NEW: ;m \ Not needed now, as select: does it if necessary.
-
- :m RELEASE:
- limit 0 DO
- i (sel): self release: super \ Harmless if not open
- nilH i ^elem4 !
- LOOP ;m
-
- :m CLEARALL:
- limit 0 DO
- i (sel): self
- handle: self IF clear: super THEN
- LOOP ;m
-
- :m DUMP:
- ." Current:" get: current . cr
- dump: super ;m
-
- :m CLASSINIT:
- idxbase limit 4* bounds
- DO nilH i ! 4 +LOOP ;m
-
- ;class
-